package com.itheima.Controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("user")
public class controller {
    @Reference
    UserService userService;

    @RequestMapping("/findUser")
    @ResponseBody
    public ModelAndView findUser(){
        List<User> user = userService.findUser();
        ModelAndView model = new ModelAndView();
        model.addObject("userlist",user);
        model.setViewName("user");
        return model;
    }

    /*@RequestMapping("/findUser")
    @ResponseBody
    public ModelAndView findUser(){
        List<User> user = userService.findUser();
        ModelAndView model = new ModelAndView();
        model.addObject("userlist",user);
        model.setViewName("user");
        return model;
    }*/

}
